#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct ac
{
	int i;
	char data[0];
};

int main()
{
  /*4006dc:	a9bc7bfd 	stp	x29, x30, [sp, #-64]!
  4006e0:	910003fd 	mov	x29, sp
  4006e4:	b9001fa0 	str	w0, [x29, #28]
  4006e8:	f9000ba1 	str	x1, [x29, #16]
  4006ec:	f9001bbf 	str	xzr, [x29, #48]*/
  void *p = NULL;

  /*4006f0:	90000000 	adrp	x0, 400000 <_init-0x538>
  4006f4:	91226001 	add	x1, x0, #0x898	// x1=x0+0x898
  4006f8:	910083a0 	add	x0, x29, #0x20	// x0=0x29+0x20
  4006fc:	f9400022 	ldr	x2, [x1]		// x2="abcdefgh"
  400700:	f9000002 	str	x2, [x0]
  400704:	79401021 	ldrh	w1, [x1, #8]	// w1='i'
  400708:	79001001 	strh	w1, [x0, #8]*/
  char buf[10] = "abcdefghi";	

  /*40070c:	d28001c0 	mov	x0, #0xe                   	// #14
  400710:	97ffff98 	bl	400570 <malloc@plt>
  400714:	f9001fa0 	str	x0, [x29, #56]*/
  struct ac * info = (struct ac *)malloc(sizeof(struct ac) + 10);

  /*400718:	f9401fa0 	ldr	x0, [x29, #56]		// x0=info
  40071c:	52800121 	mov	w1, #0x9                   	// #9
  400720:	b9000001 	str	w1, [x0]*/			// [info]=9
  info->i = 9;

  /*400724:	f9401fa0 	ldr	x0, [x29, #56]		// x0=info
  400728:	91001000 	add	x0, x0, #0x4		// x0=x0+4
  40072c:	f9001ba0 	str	x0, [x29, #48]*/	// p=x0+4
  p = (void*)info->data;

  /*400730:	90000000 	adrp	x0, 400000 <_init-0x538>
  400734:	91218000 	add	x0, x0, #0x860
  400738:	d2800081 	mov	x1, #0x4                   	// #4
  40073c:	97ffffa5 	bl	4005d0 <printf@plt>*/
  printf("%d\n", 4);

  /*400740:	f9401ba1 	ldr	x1, [x29, #48]		// x1=p
  400744:	90000000 	adrp	x0, 400000 <_init-0x538>
  400748:	9121a000 	add	x0, x0, #0x868
  40074c:	aa0103e2 	mov	x2, x1				// x2=p
  400750:	f9401fa1 	ldr	x1, [x29, #56]		// x1=info
  400754:	97ffff9f 	bl	4005d0 <printf@plt>*/
  printf("info address:%p\n", info, p);

  /*400758:	f9401ba1 	ldr	x1, [x29, #48]		// x1=p
  40075c:	90000000 	adrp	x0, 400000 <_init-0x538>
  400760:	91220000 	add	x0, x0, #0x880
  400764:	97ffff9b 	bl	4005d0 <printf@plt>*/
  printf("   p address:%p\n", p);

  /*400768:	9100c3a1 	add	x1, x29, #0x30		// x1=&p
  40076c:	90000000 	adrp	x0, 400000 <_init-0x538>
  400770:	91220000 	add	x0, x0, #0x880
  400774:	97ffff97 	bl	4005d0 <printf@plt>*/
  printf("   p address:%p\n", &p);

  /*400778:	f9401ba3 	ldr	x3, [x29, #48]	// x3=p
  40077c:	f9401fa0 	ldr	x0, [x29, #56]	// x0=info
  400780:	b9400000 	ldr	w0, [x0]		// w0=info->i
  400784:	93407c01 	sxtw	x1, w0		// x1=w0
  400788:	910083a0 	add	x0, x29, #0x20	// x0=buf
  40078c:	aa0103e2 	mov	x2, x1			// x2=info->i
  400790:	aa0003e1 	mov	x1, x0			// x1=buf
  400794:	aa0303e0 	mov	x0, x3			// x0=p
  400798:	97ffff8a 	bl	4005c0 <strncpy@plt>*/
  strncpy((char*)p, buf, info->i);

  /*40079c:	f9401ba0 	ldr	x0, [x29, #48]
  4007a0:	97ffff84 	bl	4005b0 <puts@plt>*/
  printf("%s\n", (char*)p);

  /*4007a4:	52800000 	mov	w0, #0x0                   	// #0
  4007a8:	a8c47bfd 	ldp	x29, x30, [sp], #64
  4007ac:	d65f03c0 	ret*/
  return 0;
}
